﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Patent;
using Patent.CN;
using System.Data;
using DevExpress.XtraCharts;
using Patent.LJ;

public partial class China_Chart_OrientAreaBarsView3Diagram : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            string local = Request["selected"];
            //Patent.Topic topic = new Topic();
            Patent.LJ.Topic topic = new Patent.LJ.Topic(Convert.ToInt32(Session["topicID"].ToString()));
            string localTable = topic.OriginalTable;//原产区表名

            if (string.IsNullOrEmpty(local))
            {
                Response.End();
                Response.Flush();
            }

            string[] area = local.Split(',');
            ChinaAnalysis ana = new ChinaAnalysis();
            DataTable dt = ana.GetLocalArea(area, localTable);
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                switch (dt.Columns[i].ColumnName)
                {
                    case "dm": dt.Columns[i].ColumnName = "国省代码"; break;
                    case "sy": dt.Columns[i].ColumnName = "实用新型"; break;
                    case "fm": dt.Columns[i].ColumnName = "发明专利"; break;
                    case "wg": dt.Columns[i].ColumnName = "外观设计"; break;
                    case "zj": dt.Columns[i].ColumnName = "总计"; break;
                    default: break;
                }
            }

            //WebChartCN.Series.Clear();

            //Series syxxSeries = new Series("实用新型", ViewType.Bar);
            Series syxxSeries = WebChartCN.Series["实用新型"];
            Series fmzlSeries = WebChartCN.Series["发明专利"];
            Series wgsjSeries = WebChartCN.Series["外观设计"];
            //Series fmzlSeries = new Series("发明专利", ViewType.Bar);
            //Series wgsjSeries = new Series("外观设计", ViewType.Bar);


            //WebChartCN.Series.Add(syxxSeries);
            //WebChartCN.Series.Add(fmzlSeries);
            //WebChartCN.Series.Add(wgsjSeries);

            syxxSeries.ArgumentDataMember = "国省代码";
            syxxSeries.ValueDataMembers.AddRange(new string[] { "实用新型" });


            fmzlSeries.ArgumentDataMember = "国省代码";
            fmzlSeries.ValueDataMembers.AddRange(new string[] { "发明专利" });

            //((XYDiagramSeriesViewBase)fmzlSeries.View).Pane.Name = "fmzlPane";
            //((XYDiagramSeriesViewBase)fmzlSeries.View).AxisXName = "secondaryAxisX1";


            wgsjSeries.ArgumentDataMember = "国省代码";
            wgsjSeries.ValueDataMembers.AddRange(new string[] { "外观设计" });
            //((XYDiagramSeriesViewBase)wgsjSeries.View).Pane.Name = "wgsjPane";
            //((XYDiagramSeriesViewBase)wgsjSeries.View).AxisXName = "secondaryAxisX2";

            foreach (Series series in WebChartCN.Series)
            {
                //series.Label.Visible = false;
                series.DataSource = dt;
                series.ArgumentScaleType = ScaleType.Qualitative;
                series.ValueScaleType = ScaleType.Numerical;

                series.PointOptions.PointView = PointView.Values;
                
            }

        }
        // Prevent IE Cache
        Response.Expires = 0;
    }

}
